# Maintainer: Felix Yan <felixonmars@archlinux.org>

pkgname=golang-github-burntsushi-toml
pkgver=1.2.0
pkgrel=1
pkgdesc="TOML parser for Golang with reflection"
arch=('any')
url="https://github.com/BurntSushi/toml"
license=('MIT')
depends=('go')
source=("$pkgname-$pkgver.tar.gz::https://github.com/BurntSushi/toml/archive/v$pkgver.tar.gz")
sha512sums=('6ece438c703deaaee49423e404e477a5fb44bc62f8ae3edacf3c9c0bd1233b886f72fc9f1fba15257d84e3a717434145542be1a11aa69d98d374833e3d0147ab')

check() {
  export GO111MODULE=off
  export GOPATH="$srcdir/build:/usr/share/gocode"
  mkdir -p "$srcdir"/build/src/github.com/BurntSushi
  cp -a "$srcdir"/toml-$pkgver "$srcdir"/build/src/github.com/BurntSushi/toml
  cd "$srcdir"/build/src/github.com/BurntSushi/toml
  go test -v $(go list ./...)
}

package() {
  mkdir -p "$pkgdir"/usr/share/gocode/src/github.com/BurntSushi
  cp -a "$srcdir"/toml-$pkgver "$pkgdir"/usr/share/gocode/src/github.com/BurntSushi/toml

  install -Dm644 toml-$pkgver/COPYING -t "$pkgdir"/usr/share/licenses/$pkgname/
}
